package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.api.Result;
import com.atguigu.springcloud.feign.IPaymentHystrixClient;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : wenchao.long
 * @date : Created in 2020/12/16 8:07 周三
 * @description :
 */
@RestController
@RequestMapping("/consumer")
@AllArgsConstructor
public class OrderHystrixController {

    private final IPaymentHystrixClient paymentHystrixService;

    @GetMapping("/payment/hystrix/ok/{id}")
    public Result<String> paymentInfo(@PathVariable("id") Integer id) {
        return paymentHystrixService.paymentInfo(id);
    }

    @GetMapping("/payment/hystrix/timeout/{id}")
    public Result<String> paymentInfoTimeout(@PathVariable("id") Integer id) {
        return paymentHystrixService.paymentInfoTimeout(id);
    }
}
